<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<!-- naver viewport -->
<meta name="viewport" content="width=480" content="user-scalable=yes" )/>
<!-- <meta content="user-scalable=yes, initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5, width=device-width,target-densitydpi=device-dpi" name="viewport"> -->

<!-- 		<meta name="apple-mobile-web-app-capable" content="yes" /> -->

<meta name="apple-mobile-web-app-capable" content="yes">
<title>JustWar</title>
<script language="javascript" src="js/user.info.js"
	type="text/javascript"></script>
<script language="javascript" src="js/user.timer.js"
	type="text/javascript"></script>
<script language="javascript" src="js/mj.viewport.js"
	type="text/javascript"></script>
<script language="javascript" src="js/jquery-1.8.1.min.js"
	type="text/javascript"></script>
<!-- <script language="javascript" src="js/cordova-2.0.0.js" type="text/javascript"></script> -->
<script language="javascript" src="js/jquery.progressbar.js"
	type="text/javascript"></script>
<!-- 	<script language="javascript" src="js/jquery.button-view.js" type="text/javascript"></script> -->
<script language="javascript" src="js/sprintf-0.7-beta1.js"
	type="text/javascript"></script>
<script language="javascript" src="js/image.js" type="text/javascript"></script>
<script language="javascript" src="js/result.js" type="text/javascript"></script>
<script language="javascript" src="js/global.js" type="text/javascript"></script>
<script language="javascript" src="js/Auth.js" type="text/javascript"></script>
<script language="javascript" src="js/page.js" type="text/javascript"></script>
<script language="javascript" src="js/user.js" type="text/javascript"></script>
<script language="javascript" src="js/proxy.js" type="text/javascript"></script>
<script language="javascript" src="js/popup.js" type="text/javascript"></script>
<script language="javascript" src="js/mask.js" type="text/javascript"></script>
<script language="javascript" src="js/data.js" type="text/javascript"></script>
<script language="javascript" src="js/util.js" type="text/javascript"></script>
<script language="javascript" src="js/Map.js" type="text/javascript"></script>
<script language="javascript" src="js/menu.js" type="text/javascript"></script>
<script language="javascript" src="js/application.js"
	type="text/javascript"></script>

<script language="javascript" src="js/lib/jquery.countdown.js"
	type="text/javascript"></script>
<script language="javascript" src="js/lib/jquery.countdown-ko.js"
	type="text/javascript"></script>

<!-- StringTable -->
<script language="javascript" src="js/string.table.js"
	type="text/javascript"></script>
<!-- page data -->
<script language="javascript" src="js/news.js" type="text/javascript"></script>
<script language="javascript" src="js/intro.js" type="text/javascript"></script>
<script language="javascript" src="js/mission.js" type="text/javascript"></script>
<script language="javascript" src="js/building.js"
	type="text/javascript"></script>
<script language="javascript" src="js/unit.js" type="text/javascript"></script>
<script language="javascript" src="js/general.js" type="text/javascript"></script>
<script language="javascript" src="js/myinfo.js" type="text/javascript"></script>
<script language="javascript" src="js/bank.js" type="text/javascript"></script>
<script language="javascript" src="js/hospital.js"
	type="text/javascript"></script>
<script language="javascript" src="js/shop.js" type="text/javascript"></script>
<script language="javascript" src="js/war.js" type="text/javascript"></script>
<script language="javascript" src="js/alliance.js"
	type="text/javascript"></script>
<script language="javascript" src="js/animate.js" type="text/javascript"></script>

<script language="javascript" src="js/common_android.js"
	type="text/javascript"></script>
<script language="javascript" src="js/inApp/inappbilling.js"
	type="text/javascript"></script>
<script language="javascript" src="js/GCM/GCMPlugin.js"
	type="text/javascript"></script>
<script language="javascript" src="cordova-2.2.0.js"
	type="text/javascript"></script>

<link rel="stylesheet" type="text/css" href="css/boxstyle.css" />
<link rel="stylesheet" type="text/css" href="css/btnstyle.css" />
<link rel="stylesheet" type="text/css" href="css/default.css" />
<link rel="stylesheet" type="text/css" href="css/game_layout.css" />
<link rel="stylesheet" type="text/css" href="css/intro.css" />
<link rel="stylesheet" type="text/css" href="css/liststyle.css" />
<link rel="stylesheet" type="text/css" href="css/textstyle.css" />
<link rel="stylesheet" type="text/css" href="css/popstyle.css" />
<link rel="stylesheet" type="text/css" href="css/animate.css" />
<style>
</style>
<script type="text/javascript">
	function update(scale) {
		// 		document.getElementById("useragent").textContent = navigator.userAgent;
		// 		document.getElementById("scale").textContent = scale || "none";
		// 		if(mj.viewport.isIos()){
		// 			document.getElementById("device").textContent = "iOS";
		// 		}else if(mj.viewport.isAndroid()){
		// 			document.getElementById("device").textContent = "Android";
		// 		}else if(mj.viewport.isPCBrowser()){
		// 			document.getElementById("device").textContent = "PC";
		// 		}
	}

	mj.viewport({
		width : 480,
		onAdjustment : update
	});
	if (mj.viewport.isIos()) {
		window.addEventListener("load", function() {
			update(null);
		});
	}

	function onDeviceReady() {
		//     	alert('device 레디햇다');
		//phonegap ready function
		console.log('onDeviceReady');

		if (cordova.addPlugin) {
			cordova.addConstructor(function() {
				//Register the javascript plugin with Cordova
				cordova.addPlugin('GCM', new GCM());
			});
		} else {
			window.GCM = new GCM();
		}

		common.initInAppBilling();
		common.initGCMService("809138504094");
		common.bindEvents();
	}

	function getTabBar() {
		var html = '<div id="top_menu_box">';
		html += '<ul id="top_menu">';
		html += '<li id="top_menu_news"><a href="javascript:gotoMenu(1);" class="buttonMenu"><img src="images/UI/android/ui_footer-ui_btn-news_'
				+ (currentPage == "news" ? "touch" : "normal")
				+ '.png" /></a></li>';
		html += '<li id="top_menu_mission"><a href="javascript:gotoMenu(2);" class="buttonMenu"><img src="images/UI/android/ui_footer-ui_btn-mission_'
				+ (currentPage == "mission" ? "touch" : "normal")
				+ '.png" /></a></li>';
		html += '<li id="top_menu_war"><a href="javascript:gotoMenu(3);" class="buttonMenu"><img src="images/UI/android/ui_footer-ui_btn-war_'
				+ (currentPage == "war" ? "touch" : "normal")
				+ '.png" /></a></li>';
		html += '<li id="top_menu_unit"><a href="javascript:gotoMenu(4);" class="buttonMenu"><img src="images/UI/android/ui_footer-ui_btn-unit_'
				+ (currentPage == "unit" ? "touch" : "normal")
				+ '.png" /></a></li>';
		html += '<li id="top_menu_building"><a href="javascript:gotoMenu(5);" class="buttonMenu"><img src="images/UI/android/ui_footer-ui_btn-building_'
				+ (currentPage == "building" ? "touch" : "normal")
				+ '.png" /></a></li>';
		html += '<li id="top_menu_general"><a href="javascript:gotoMenu(6);" class="buttonMenu"><img src="images/UI/android/ui_footer-ui_btn-general_'
				+ (currentPage == "general" ? "touch" : "normal")
				+ '.png" /></a></li>';
		html += '</ul>';
		html += '</div>';
		return html;
	}

	function setLoginPage() {
		//     	$('#main_div').html(getLoginBox());
		changeHTML('#main_div', getLoginBox());
	}

	function init() {
		//step one
		console.log('init!');
		document.addEventListener("deviceready", onDeviceReady, false);
		if (!localStorage.getItem('uuid')) {
			//Auth 관련 로직 여기쯤에..
			console.log('start login page');
			setLoginPage();
		}
		checkDevice();
	}

	function callStepTwo() {
		getCountrySelectBox();
	}
</script>
</head>
<div id="transMask"></div>
<div id="popupMask" style="display: none;"></div>
<div id="popup" style="display: none;"></div>
<body onload="javascript:init();">
	<div id="main_div">
		<div id="top_content_box"></div>
		<div id="top_menu_box">
			<ul id="top_menu">
				<input type="button" value="DevTestPlugin으로 메세지 보내기"
					onClick="javascript:Cordova.exec(null,null,'DevTestPlugin','test',['Hello Test']);" />
				<input type="button" value="Login Success"
					onClick="javascript:common.loginResult('success');" />
				<input type="button" value="Login Fail"
					onClick="javascript:common.loginResult('fail');" />
				<input type="button" value="onOffline"
					onClick="javascript:Cordova.exec(null,null,'BridgePlugin','network',['offline']);" />

				<input type="button" value="changeMenu_1"
					onClick="javascript:common.changeMenuButton('1');" />
				<input type="button" value="changeMenu_2"
					onClick="javascript:common.changeMenuButton('2');" />
				<input type="button" value="changeMenu_3"
					onClick="javascript:common.changeMenuButton('3');" />
				<input type="button" value="changeMenu_4"
					onClick="javascript:common.changeMenuButton('4');" />
				<input type="button" value="changeMenu_5"
					onClick="javascript:common.changeMenuButton('5');" />
				<input type="button" value="changeMenu_6"
					onClick="javascript:common.changeMenuButton('6');" />

				<input type="button" value="1000Coin Purchase"
					onClick="javascript:common.startInAppPurchase('com.aprointeractive.android.justwar.1000coin');" />
				<input type="button" value="2000Coin Purchase"
					onClick="javascript:common.startInAppPurchase('com.aprointeractive.android.justwar.2000coin');" />
				<input type="button" value="3000Coin Purchase"
					onClick="javascript:common.startInAppPurchase('com.aprointeractive.android.justwar.3000coin');" />
				<input type="button" value="Purchase Fail"
					onClick="javascript:common.startInAppPurchase('com.aprointeractive.android.justwar.5000coin');" />

				<input type="button" value="Disable Input(Need app Restart)"
					onClick="javascript:common.allTouchControl('disable');" />

			</ul>
		</div>
	</div>
	<!-- end of main_div-->

</body>

</html>
